<template>
    <div>
        <el-button type="warning" id="_curseBtn" @click="seeCurse" v-if="!see">查看解析</el-button>
        <img :src="test.curseImgSrc" alt="图片消失了" v-if="see">
    </div>
</template>

<script>
    export default {
        name: "TestCurse",
        data() {
            return {
                testId: 0,
                test: {
                    curseImgSrc: "",
                },
                see: false,
            }
        },
        methods: {
            seeCurse() {
                this.$confirm('查看解析后得分会减少', '是否查看解析', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    this.see = true;
                    this.$axios.get('/testDetail/seeCurse', {
                        params: {
                            testId: this.testId
                        }
                    }).then(res => {

                    })
                }).catch(() => {
                    this.see = false;
                });
            }
        },
        activated() {
            if (sessionStorage.getItem("seeAnswer")){
                this.see = true;
            }
            this.test.curseImgSrc = sessionStorage.getItem('curseImgSrc');
        }
    }
</script>

<style scoped>
#_curseBtn{
    position: relative;
    top: -50px;
    left: 400px;
    z-index: 999;
}
</style>